from neuralprophet import NeuralProphet
from data_processing import load_data
import pandas as pd
import matplotlib.pyplot as plt

data = load_data()
df = pd.DataFrame()
df['ds'] = data['date']
df['y'] = data['btc']

# for i in range(450, len(df)):# 220
#     m = NeuralProphet(weekly_seasonality=False, batch_size=512)
#     df_now = df[:i+1]
#     metrics = m.fit(df_now, freq="D")
#     future = m.make_future_dataframe(df_now, periods=100, n_historic_predictions=False)
#     forecast = m.predict(future)
#     # m.plot(forecast).show()
#     # forecast.to_csv(f'./for/for_{i}.csv')
#     if i == 460:
#         print(i)

m = NeuralProphet(n_lags=5, n_forecasts=5, weekly_seasonality=False, batch_size=512)
metrics = m.fit(df, freq="D")
future = m.make_future_dataframe(df, periods=365, n_historic_predictions=True)
forecast = m.predict(future)
fig1 = m.plot(forecast)
fig1.show()
plt.plot(forecast['yhat1'], forecast['ds'])
# forecast.to_csv('ar_gold.csv')
# fig2 = m.plot_parameters(forecast)
# fig2.show()

pass
